<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>simCameraFitToView</title>
<link rel="stylesheet" type="text/css" href="../../style.css">
</head>

<body>

<div align="center">
<table class=allEncompassingTable >
 <tr>
  <td >
<p><a href="../../index.html" TARGET="_top"><img src="../images/homeImg.png"></a></p>

<h1><a href="../apiOverview.htm">Regular API</a> function</h1>
<h3 class=subsectionBar><a name="simCameraFitToView" id="simCameraFitToView"></a>simCameraFitToView / sim.cameraFitToView </h3>
<table class=apiTable>
<tr class=apiTableTr> 
<td class=apiTableLeftDescr>
Description 
</td> 
<td class=apiTableRightDescr>Shifts and adjusts a camera associated with a view to fill the view entirely with the specified objects or models. See also the <a href="simAdjustView.htm">sim.adjustView</a> and <a href="simFloatingViewAdd.htm">sim.floatingViewAdd</a> functions.<br></td>
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCSyn>
C synopsis
</td> 
<td class=apiTableRightCSyn>simInt simCameraFitToView(simInt viewHandleOrIndex,simInt objectCount,const simInt* objectHandles,simInt options,simFloat scaling)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCParam>C parameters</td> 
<td class=apiTableRightCParam>
<div><strong>viewHandleOrIndex</strong>: the handle of the view (can also be a floating view), or the index of the view. If the camera is not associated with any view, then you can specify the handle of the camera, together with the <em>sim_handleflag_camera</em> flag.</div>
<div><strong>objectCount</strong>: number of intems in the objectHandles pointer. Can be 0, in which case the whole visible scene will be filling the view.</div>
<div><strong>objectHandles</strong>: pointer to objectHandles. Only visible objects will be taken into account. Can be nullptr, in which case the whole visible scene will be filling the view.</div>
<div><strong>options</strong>: bit-coded:</div>
<div class=tab>bit0 (1): if set, then individual objects will be filling the view. If not set, then models associated with model base objects will also be included</div>
<div class=tab>bit1 (2): if set, then the view proportions will be 1 by 1, independently on what the view size is</div>
<div><strong>scaling</strong>: scaling factor. Use '1' for normal behaviour.</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftCRet>
C return value
</td> 
<td class=apiTableRightCRet>
<div>-1 if operation was not successful. 0 for a silent error (e.g. when the indicated view doesn't exist anymore), 1 for success<br>
</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLSyn>
Lua synopsis
</td> 
<td class=apiTableRightLSyn>number result=sim.cameraFitToView(number viewHandleOrIndex,table objectHandles=nil,simInt options=0,simFloat scaling=1)<br></td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLParam>Lua parameters</td> 
<td class=apiTableRightLParam>
<div>Similar to the C-function counterpart</div>
</td> 
</tr> 
<tr class=apiTableTr> 
<td class=apiTableLeftLRet>
Lua return values
</td> 
<td class=apiTableRightLRet>
<div>Similar to the C-function counterpart </div>
<div></div></td> 
</tr> 
</table> 

<br>
<p><a href="../apiFunctions.htm">All regular API functions on one page</a></p>
<br>
<br>
</td>
</tr>
</table>
</div>
</body>
</html>
